Skip to content

.Net: SK integration with MEAI Abstractions #10754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
May 20, 2025
Merged

Conversation

…nts) Phase 1 (#10651)

### Motivation and Context

- Resolves partially #10319 

This change adds a new `IChatClientSelector` abstraction to work without
breaking current `IAIServiceSelector` implementations.

This was necessary because `Kernel` now will be able to resolve
`IChatClient`s which are not `IAIService` implementations, and
`OrderedAIServiceSelector` now can select not only `AIServices` but
`ChatClients` as well by implementing the `IChatClientSelector`
interface.

All other changes are related to test accepting `IChatClient`s added to
the `Service` DI container, ensuring they work as expected together with
current `IChatCOmpletionService` and `ITextGenerationService` in the
`Kernel`.
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Mar 3, 2025
@RogerBarreto RogerBarreto changed the title .Net: SK integration with MEAI Abstractions .Net: SK integration with MEAI Abstractions (Main Sync) - WIP Mar 3, 2025
@github-actions github-actions bot changed the title .Net: SK integration with MEAI Abstractions (Main Sync) - WIP .Net: SK integration with MEAI Abstractions Mar 3, 2025
@RogerBarreto RogerBarreto self-assigned this Mar 3, 2025
@RogerBarreto RogerBarreto added the PR: in progress Under development and/or addressing feedback label Mar 3, 2025
…1049)

# Add ChatClient Support to ChatCompletionAgent

- Resolve #10729 

## Motivation and Context

This PR enhances ChatCompletionAgent to support `IChatClient` alongside
existing IChatCompletionService, providing more flexibility in how chat
completions are handled. This enables better integration with existing
`Microsoft.Extensions.AI` types.

## Description

### Core Changes

1. Enhanced ChatCompletionAgent to:
   - Support both IChatClient and IChatCompletionService interfaces
   - Maintain backward compatibility with existing implementations

2. Updated Sample Code:
   - Added new examples in Concepts demonstrating ChatClient usage
- Updated Getting Started With Agents samples to showcase both service
types

3. Added Comprehensive Unit Tests:
   - Test coverage for Agents with ChatClient integration
   - Verification of both streaming and non-streaming scenarios

4. Added `IChatClient.AsKernelFunctionInvokingClient` extension method
to enable Kernel Function Invocation support with `IChatClient` for
solutions that target `.NET 8 LTS` only.
…ilderPattern (#12132)

- Resolves #12087 
- Add KernelChatOptions to avoid undesired leaking serializations to AI
Models.
- Added More ChatClient Extension methods to Amazon Bedrock and Azure AI
Inference
- Updated existing ChatClient using the latest changes, 
- Code improvements/clean up.
@RogerBarreto RogerBarreto marked this pull request as ready for review May 19, 2025 18:19
@RogerBarreto RogerBarreto requested a review from a team as a code owner May 19, 2025 18:19
Copy link
Member

@markwallace-microsoft markwallace-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes have been reviewed on their way into the feature branch

@RogerBarreto RogerBarreto added this pull request to the merge queue May 20, 2025
Merged via the queue into main with commit 57bac49 May 20, 2025
24 checks passed
@RogerBarreto RogerBarreto deleted the feature-msextensions-ai branch May 20, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code PR: in progress Under development and/or addressing feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.Net: Native Integration with Microsoft.Extensions.AI - Phase 1
3 participants